/**
 * Licensee: DuKe TeAm
 * License Type: Purchased
 */
package ormsamples;

import org.orm.*;
public class DeletePrueba1PDSData {
	public void deleteTestData() throws PersistentException {
		PersistentTransaction t = orm.Prueba1PDSPersistentManager.instance().getSession().beginTransaction();
		try {
			orm.DAOFactory lDAOFactory = orm.DAOFactory.getDAOFactory();
			orm.dao.AtencionDAO oRMAtencionDAO = lDAOFactory.getAtencionDAO();
			orm.Atencion oRMAtencion = oRMAtencionDAO.loadAtencionByQuery(null, null);
			// Delete the persistent object
			oRMAtencionDAO.delete(oRMAtencion);
			orm.dao.PrestacionDAO oRMPrestacionDAO = lDAOFactory.getPrestacionDAO();
			orm.Prestacion oRMPrestacion = oRMPrestacionDAO.loadPrestacionByQuery(null, null);
			// Delete the persistent object
			oRMPrestacionDAO.delete(oRMPrestacion);
			orm.dao.PacienteDAO oRMPacienteDAO = lDAOFactory.getPacienteDAO();
			orm.Paciente oRMPaciente = oRMPacienteDAO.loadPacienteByQuery(null, null);
			// Delete the persistent object
			oRMPacienteDAO.delete(oRMPaciente);
			t.commit();
		}
		catch (Exception e) {
			t.rollback();
		}
		
	}
	
	public static void main(String[] args) {
		try {
			DeletePrueba1PDSData deletePrueba1PDSData = new DeletePrueba1PDSData();
			try {
				deletePrueba1PDSData.deleteTestData();
			}
			finally {
				orm.Prueba1PDSPersistentManager.instance().disposePersistentManager();
			}
		}
		catch (Exception e) {
			e.printStackTrace();
		}
	}
}
